package com.ease.core.components {
   import com.ease.core.components.menus.IMenuProvider;

   import mx.controls.Label;
   import mx.controls.Menu;
   import mx.controls.MenuBar;
   import mx.events.FlexEvent;
   import mx.events.MenuEvent;

   public class StageMenuBar extends MenuBar {
      public var menuBarProvider:IMenuProvider;

      public function StageMenuBar() {
         this.labelField = "label";
         this.iconField = "icon";

         this.addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
         this.addEventListener(MenuEvent.ITEM_CLICK, onMenuBarItemClick);
      }

      override public function getMenuAt(index:int):Menu {
         var menu:Menu = super.getMenuAt(index);
         menu.variableRowHeight = true;
         return menu;
      }

      private function onCreationComplete(event:FlexEvent):void {
      }

      private var welcomeLabel:Label;

      override protected function createChildren():void {
         super.createChildren();
      }

      private function onMenuBarItemClick(event:MenuEvent):void {
         this.menuBarProvider.onMenuItemClick(event);
      }
   }
}